using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using Molic.ShapeLibrary;
using Molic.Core;

using System.Reflection;
using System.Collections.ObjectModel;

using Spring.Context;
using Spring.Context.Support;

namespace Molic.Main
{
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>
    public partial class Window1 : System.Windows.Window
    {

        #region Constructor
        public Window1()
        {
            InitializeComponent();

            // inject the Molic UI elments into the control
            IApplicationContext ctx = ContextRegistry.GetContext();
            IMolicController controller = (IMolicController)ctx.GetObject("MolicController");
            controller.Models = canvas.Children;
            controller.SelectionService = canvas.SelectionService;

            this.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            canvas.MouseMove += OnMouseMove;
            canvas.KeyDown += new KeyEventHandler(canvas_KeyDown);
            canvas.ClipToBounds = true;

            canvas.Focusable = true;
            canvas.Focus();
        }

        void ShapeFactory_OnShapeAdded(object sender, MolicShapeEventArgs e)
        {
        }
        
        #endregion

        #region Methods

        void OnLoad(object sender, EventArgs e)
        {  
        }

        #region Pass through user interaction
        /// <summary>
        /// Canvas KeyDown handler
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void canvas_KeyDown(object sender, KeyEventArgs e)
        {
            //if (selectedShape != null && e.Key == Key.Delete)
            //{
            //    elements.Remove(selectedShape);
            //    canvas.Children.Remove(selectedShape);
            //}
        }

        /// <summary>
        /// Canvas MouseMove handler
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        protected void OnMouseMove(object sender, MouseEventArgs args)
        {
            
        }

        #endregion

     

        #endregion
    }
}